<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link href="${initParam.url }/statics/css/complaint.css" rel="stylesheet">
<style type="text/css">
	#myModal ul,#myModal li{
		list-style: none;
		padding: 0px;
		margin: 0px;
		font-size: 18px;
	}
	#myModal ul{
		margin: 10px;
		padding-left: 20px;
	}
</style>
<script type="text/javascript">
	function query(id){
		$.ajax({
			type:"post",
			data:{id:id},
			url:"/property/owner/getHandle",
			dataType : "json",
			success : function(data) {
				if(data!=null&&data!=""){
					$("#content1").text(data.complaint.content);
					$("#time1").text(data.complaint.dateTime);
					$("#replycontent").text(data.replyContent);
					$("#time2").text(data.dateTime);
					$("#phone").text(data.management.phone);
					if(data.complaint.type=="报修"){
						$("#image1").show();
						$("#image2").attr("src","${initParam.url}/statics"+data.complaint.repairsImage);
					}
					if(data.complaint.type=="投诉"){
						$("#image1").hide();
					}
				}
			},
			error : function() {
				alert("加载失败");
			}
		})
		$("#myModal").modal();
	}
</script>
</head>
<body>
	<div
		style="width: 1090px; height: 500px; background-color: #FFF; margin: 20px;">
		<h4
			style="background-color: #9FB2C2; padding-left: 10px; color: #516D8A; line-height: 40px;">
			<img alt="" src="${initParam.url}/statics/images/title.jpg">
			投诉报修处理
		</h4>
		<div class="table">
		<table class="table-1" >
			<c:forEach var="cd" items="${cdList }">
				<tr>
					<td>
					投诉时间：<fmt:formatDate pattern="yyyy-MM-dd hh:mm:ss"  value="${cd.complaint.dateTime}"/> &nbsp;
					<c:if test='${cd.dateTime==null||cd.dateTime =="" }'>
						<a href="javascript:void(0);" >投诉报修内容：${cd.complaint.content }</a>
					</c:if>
					<c:if test='${cd.dateTime!=null }'>
						<a href="javascript:void(0);"  onclick="query(${cd.id})" >投诉报修内容：${cd.complaint.content }</a>
					</c:if>
					</td>
					<td>
						处理时间：
						<c:if test='${cd.dateTime==null||cd.dateTime =="" }'>
							暂未处理
						</c:if>
						<c:if test='${cd.dateTime!=null }'>
							<fmt:formatDate pattern="yyyy-MM-dd hh:mm:ss"  value="${cd.dateTime }"/>
						</c:if>
					</td>
				</tr>
			</c:forEach>
		</table>
		</div>
		
		<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" style="width: 500px;height: 350px;background-color: #FFF;margin: auto;padding-top: 0px;">
				 <div class="modal-header">
  					<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
  					<h4 class="modal-title" id="myModalLabel">处理详情</h4>
 				</div>
 				<div>
 					<ul>
 						<li>投诉内容：<label id="content1">测试</label></li>
 						<li>投诉时间：<label id="time1">测试</label></li>
 						<li id="image1">报修图片：<img width="120px" onerror="this.src='${initParam.url }/statics/images/暂无图片.jpg'" height="80px" alt=""  id="image2" src=""/></li>
 						<li>回复内容：<label id="replycontent">测试</label></li>
 						<li>处理时间：<label id="time2">测试</label></li>
 						<li>处理人联系方式：<label id="phone">测试</label></li>
 						<li>有任何问题，请拨打以上电话 。。。谢谢</li>
 					</ul>
 				</div>
			</div>
		
		<div class="ta-1">
		<c:if test="${page<2 }">
			<a href="#">第一页</a>
		</c:if>
		<c:if test="${page>1 }">
			<a href="?id=${param.id }&page=1">第一页</a>
		</c:if>
		<c:if test="${page<2 }">
			<a href="#">上一页</a>
		</c:if>
		<c:if test="${page>1 }">
			<a href="?id=${param.id }&page=${page-1 }">上一页</a>
		</c:if>
			<c:if test="${page<sum }">
				<a href="?id=${param.id }&page=${page+1}">下一页</a>
			</c:if>
			<c:if test="${page==sum }">
				<a href="#">下一页</a>
			</c:if>
			<c:if test="${page==sum }">
				<a href="#">最后一页</a>
			</c:if>
			<c:if test="${sum>page }">
				<a href="?id=${param.id }&page=${sum }">最后一页</a>
			</c:if>
		</div>
	</div>
</body>
</html>